package com.example.s05_shop.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.s05_shop.mapper.AdminMapper;
import com.example.s05_shop.pojo.Admin;
import com.example.s05_shop.service.IAdminService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Service
public class AdminServiceImpl extends ServiceImpl<AdminMapper, Admin> implements IAdminService
{

    @Autowired
    AdminMapper adminMapper;

    @Override
    public boolean checkName(String username)
    {
        Map<String,Object> m = new HashMap<>();
        m.put("username",username);
        List<Admin> results = adminMapper.selectByMap(m);
        return  results.size()<1;
    }
}
